package com.zhiwei.msf.app.constants;

import lombok.Getter;

/**
 * @author ZHIWEI.YANG
 * @time 2019/11/10 - 17:58
 * @decription 发版系统字典类型枚举
 */
@Getter
public enum DictTypeEnum {

	ROOT("00000", "顶级字典分类"), LANGUAGE("00001", "编程语言"), BUILD("00002", "构建类型"), DEPLOY("00003", "部署类型"),
	PROJECT("00004", "项目类型");

	/**
	 * 字典类型编码
	 */
	private final String typeCode;

	/**
	 * 字典类型描述
	 */
	private final String desc;

	DictTypeEnum(String typeCode, String desc) {
		this.typeCode = typeCode;
		this.desc = desc;
	}

	/**
	 * 通过字典类型编码获取数据字典枚举
	 *
	 * @param typeCode 字典类型编码
	 * @return
	 */
	public static DictTypeEnum getPublishDictTypeEnumByCode(String typeCode) {
		if (null == typeCode) {
			return null;
		}
		for (DictTypeEnum dictTypeEnum : DictTypeEnum.values()) {
			if (dictTypeEnum.typeCode.equals(typeCode)) {
				return dictTypeEnum;
			}
		}
		return null;
	}

}